package com.ttg.web.controller.common;

import com.ttg.common.entities.BaseResult;
import com.ttg.common.utils.RequestParamsManager;
import com.ttg.model.dto.*;
import com.ttg.model.vo.VipWhiteListAddOrEditVo;
import com.ttg.model.vo.VipWhiteListDetailVo;
import com.ttg.web.service.VipWhiteListService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api("vip商户白名单")
@RestController
@RequestMapping("/vipWhiteList")
public class VipWhiteListController {
    @Autowired
    private VipWhiteListService vipWhiteListService;

    @PostMapping("/mct/getList")
    public BaseResult mctGetList(@RequestBody String data){
        MctInfoListGetDto mctInfoListGetDto = RequestParamsManager.transformRequestParam(data, MctInfoListGetDto.class);
        return BaseResult.success(vipWhiteListService.mctGetList(mctInfoListGetDto));
    }
    @PostMapping("/vip/getList")
    public BaseResult vipGetList(@RequestBody String data){
        VipInfoListGetDto vipInfoListGetDto = RequestParamsManager.transformRequestParam(data, VipInfoListGetDto.class);
        return BaseResult.success(vipWhiteListService.vipGetList(vipInfoListGetDto));
    }
    @PostMapping("/addOrEdit")
    public BaseResult addOrEdit(@RequestBody String data){
        VipWhiteListAddOrEditVo vipWhiteListAddOrEditVo = RequestParamsManager.transformRequestParam(data, VipWhiteListAddOrEditVo.class);
        return BaseResult.success(vipWhiteListService.addOrEdit(vipWhiteListAddOrEditVo));
    }
    @PostMapping("/updateStatus")
    public BaseResult updateStatus(@RequestBody String data){
        VipWhiteListDetailVo vipWhiteListDetailVo = RequestParamsManager.transformRequestParam(data, VipWhiteListDetailVo.class);
        return BaseResult.success(vipWhiteListService.updateStatus(vipWhiteListDetailVo));
    }

}
